fix: handle missing parsed_lldp in baremetal ports inspection hook - #2287
Merged
Conversation
The InspectHookUpdateBaremetalPorts._parse_plugin_data function accessed plugin_data['parsed_lldp'] (and 'all_interfaces') with hard key lookups. The parse-lldp hook only populates parsed_lldp when at least one interface reports usable LLDP TLVs, so a node returning no LLDP data caused a KeyError that failed inspection: Unexpected exception KeyError during processing for node: <uuid>. Error: 'parsed_lldp' Read both keys defensively with .get() so the existing 'No LLDP data' guard in __call__ handles the node gracefully instead of failing inspection. Add tests for the missing and empty parsed_lldp cases. AMMO-1323
RSabounds
force-pushed
the
ammo-1323/fix-parsed-lldp-keyerror
branch
from
September 2, 2026 21:27
4ce5d0b to
18bcd10
Compare
nicholaskuechler
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handle a missing
parsed_lldpkey in the baremetal ports inspection hook so a node with no host-side LLDP skips gracefully instead of failing inspection.Problem
InspectHookUpdateBaremetalPorts._parse_plugin_dataaccessedplugin_data["parsed_lldp"](and["all_interfaces"]) with hard key lookups. Theparse-lldphook only populatesparsed_lldpwhen at least one interface reports usable LLDP TLVs. When a node returns no host-side LLDP, the key is absent and inspection fails:The
__call__method already handles the empty case (logs "No LLDP data" and returns), but_parse_plugin_datacrashed on the missing key before that guard could run.Change
parsed_lldpandall_interfacesdefensively with.get(...) or {}, so_parse_plugin_datareturns an empty list and the existing "No LLDP data" guard handles the node instead of raisingKeyError.parsed_lldpand empty-parsed_lldpcases.Context
A node can legitimately present no host-side LLDP (cabling/timing, a switch port down, or — as seen in the field — an Intel E810 NIC in Safe Mode whose firmware LLDP agent consumes inbound LLDPDUs before the host sees them). The E810 Safe Mode root cause is addressed separately by including the
iceDDP in the IPA ramdisk (PUC-2035). This change is the defensive backstop so inspection degrades gracefully rather than crashing when LLDP is genuinely absent.AMMO-1323